home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-21 | 4.6 KB | 176 lines | [TEXT/MPS ] |
- //******************************************************************************
- //******************************************************************************
- /*
- File: Brickout.h
-
- Contains: Header for a sample dcmd which plays brickout.
-
- Written by: Andy Bachorski and Nat McCully
-
- Copyright: © 1998 by Apple Computer, Inc., All Rights Reserved.
-
- Change History (most recent first):
-
- <1> 98-6-19 Written for the MacHack 98 Hack Contest.
-
- The following MPW commands will build the dcmd and copy it to the "Debugger Prefs" file
- in the System folder. The dcmd's name in MacsBug will be the name of the file built by
- the Linker.
-
- set MacsBugLibs "Tools:OtherSDKs:Building dcmds:MacsBug 6.5.4a3:MacsBug 6.5.4a3:Building dcmds:dcmd Libraries:"
- SC BrickOut.c -i "Tools:OtherSDKs:Building dcmds:MacsBug 6.5.4a3:MacsBug 6.5.4a3:Building dcmds:dcmd Includes:"
- Link -o BrickOut -sg Main=STDCLIB,STDIO,SANELIB BrickOut.o ∂ ∂
- "{MacsBugLibs}dcmdGlue.a.o"
- BuildDcmd BrickOut 195 -format3
- Echo 'include "BrickOut";' | Rez -a -o "{SystemFolder}Debugger Prefs"
-
- */
-
-
- //******************************************************************************
-
- #ifndef _MacBrickOut_
- #define _MacBrickOut_
-
- #ifndef __MEMORY__
- #include <Memory.h>
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
- #ifndef __STRING__
- #include <string.h>
- #endif
-
- #ifndef __DCMD__
- #include "dcmd.h"
- #endif
-
- //******************************************************************************
-
- #define kScreenLines 42
- #define MaxSpeed 4
-
- #define BricksH numBricksX
- #define BricksV numBricksY
-
- #define WidthCalc brickWidth
- #define HeightCalc brickHeight
-
- #define kHit 1
- #define kSafe 0
-
- #define KeyMapLoMem ((unsigned char *)0x174)
- #define KeyIsDown(key) (( KeyMapLoMem[ key >> 3 ] >> ( key & 7)) &1)
-
- #define aKey 0x00
- #define sKey 0x01
- #define fourKey 0x56
- #define sixKey 0x58
-
- #define kSplashColorBlack 0x15
- #define kSplashColorBlue 0x02
- #define kSplashColorLtBlue 0x03
- #define kSplashColorGreen 0x04
- #define kSplashColorPurple 0x01
- #define kSplashColorRed 0x06
- #define kSplashColorYellow 0x05
-
- //******************************************************************************
-
- enum {
- numRows = 0x01a8,
- topBorder = 8,
- bottomBorder = 8,
- sideBorder = 4,
- leftEdge = 74,
- brickWidth = 56, // byte * 8 = 48 pixels
- halfBrickWidth = brickWidth / 2,
- brickHeight = 12, // 1 row = 1 pixel * 12 = 12 pixels
- halfBrickHeight = brickHeight / 2,
- numBricksX = 10,
- numBricksY = 6,
- kWhite = 0x00,
- kBlack = 0x01,
- kRed = 0x02,
- ballSize = brickHeight,
- halfBallSize = ballSize / 2,
- paddleWidth = brickWidth,
- halfPaddleWidth = paddleWidth / 2,
- paddleHeight = brickHeight,
- halfPaddleHeight= brickHeight / 2,
- paddleMoveAmt = 2
- };
-
- //******************************************************************************
-
- extern long gRunning;
- extern long gFellOff;
-
- extern UInt32 gScreenBase;
- extern UInt32 gScreenRowBytes;
- extern UInt32 gScreenEnd;
-
- extern UInt32 gDrawBoundsTop;
- extern UInt32 gDrawBoundsBottom;
- extern UInt32 gDrawWidth;
-
- extern UInt32 gBrickLeft;
- extern UInt32 gBrickRight;
-
- extern UInt32 gBallStartX;
- extern UInt32 gBallStartY;
-
- extern Rect ballRect;
- extern Rect oldBallRect;
-
- extern UInt32 gPaddleStartX;
- extern UInt32 gPaddleStartY;
-
- extern Rect paddleRect;
- extern Rect oldPaddleRect;
-
- extern Point speed;
-
- extern char blackBallx[];
-
- extern char blackBall[];
-
- extern char whiteBall[];
-
- extern short BrickState[BricksH][BricksV];
- extern Rect Bricks[BricksH][BricksV];
-
- extern Rect gSplashRect;
- extern char gSplashBits[];
- extern Point gSplashDimensions;
-
-
- //******************************************************************************
-
- extern pascal void CommandEntry( dcmdBlock* paramPtr );
- extern void DoBrickOut( void );
- extern long PauseWithPolling( void );
- extern void InitGlobals( void );
- extern void InitBallStart( void );
- extern void DrawBorder( void );
- extern void DrawBricks( void );
- extern void DrawBrick( short xLoc, short yLoc, Rect *rect );
- extern void FadeToBlack( void );
- extern void CheckCollide( void );
- extern char * XYtoAddress( long xLoc, long yLoc );
- extern void DrawBall( Rect *ballRectPtr, char * ballBits );
- extern void UpdateBall( void );
- extern void DrawPaddle( Rect *paddleRectPtr );
- extern void UpdatePaddles( void );
- extern void DrawSplashScreen( Rect *splashRectPtr, char * splashBits, Point * dimensions );
-
- //******************************************************************************
- //******************************************************************************
- #endif // _MacBrickOut_